package com.kitchen.ui.button
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	public class IButtom extends Sprite
	{
		protected var bitMap:Bitmap;
		protected var state:int;
		public var h:Number;
		public var w:Number;
		
		public function IButtom(bitMapData:BitmapData)
		{
			super();
			this.bitMap = new Bitmap(bitMapData);
			this.addChild(this.bitMap);
			this.useHandCursor = true;
			this.buttonMode = true;
			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
			this.addEventListener(MouseEvent.MOUSE_UP, onMouseOver);
		}
		
		protected function drawMask(width:Number, height:Number):void{
			this.w = width;
			this.h = height;
			var shape:Shape = new Shape();
			shape.graphics.lineStyle(1, 0xffffff, 0.001);
			shape.graphics.beginFill(0xffffff, 1);
			shape.graphics.drawRect(0, 0, width, height);
			shape.graphics.endFill();
			this.mask = shape;
			this.addChild(shape);
		}
		
		protected function offsetX(ox:Number):void{
			this.bitMap.x = -ox;
		}
		
		protected function offsetY(oy:Number):void{
			this.bitMap.y = -oy;
		}
		
		protected function onMouseOver(me:MouseEvent):void{
			
		}
		
		protected function onMouseDown(me:MouseEvent):void{
			
		}
		
		protected function onMouseOut(me:MouseEvent):void{
			
		}
	}
}